﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;
using Microsoft.Win32;
using System.Drawing;
using System.Runtime.InteropServices;

namespace EPN.ManagementStudio
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            CustomExceptionHandler eh = new CustomExceptionHandler();
            Application.ThreadException += new ThreadExceptionEventHandler(eh.OnThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
          
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                if (e.ExceptionObject != null && e.ExceptionObject is Exception)
                {
                    Exception ex = (Exception)e.ExceptionObject;
                    MessageBox.Show(ex.Message);
                }
                else
                {
                    MessageBox.Show("Unhandled Exception Detected");
                }
            }
            catch
            {
            }
        }
    }

    public struct MENUINFO
    {
        public int cbSize;
        public uint fMask;
        public int dwStyle;
        public int cyMax;
        public int hbrBack;
        public int dwContextHelpID;
        public int dwMenuData;
    }
  
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
    public sealed class FunctionCode : Attribute
    {
        private string _value;

        public string Value
        {
            get
            {
                return _value;
            }
        }

        public FunctionCode(string value)
        {
            _value = value;
        }
    }
}
